/**
 * @file
 * @description 角色模块接口文件
 */
import request from "./request"

/**
 * @method
 * @description 获取角色列表  roles
 */
export const Roleslist = () => request.get('roles')

/**
 * @method
 * @description 获取权限列表  right
 */
export const Rrightlist = () => request.get("rights/list")

/**
 * @method
 * @description 添加角色接口
 * @param {Object} model 要添加的对象 
 */
export const addRoles = (model) => request.post("roles", model)

/**
 * @method
 * @description 修改角色
 * @param {Number} id  用户ID
 * @param {object} rid 角色ID
 */
export const updataRoles = (model) => request.put(`roles/${model.id}`, model)

/**
 * @method
 * @description 删除角色接口
 * @param {Object} model 要更改的数据对象
 */
export const delRoles = (id) => request.delete('roles/' + id)

/**
 * @method
 * @description 获取权限列表数据
 */
export const getMenus = () => request.get("rights/tree")

/**
 * @method
 * @description 分配权限
 * @param {Number} roleId 要修改的角色ID
 * @param {String} rids   要添加的角色ID
 */
export const updataRights = (id, rids) => request.post(`roles/${id}/rights`, { rids })

/**
 * @method
 * @description 删除标签
 * @param {Number} roleId    要删除的角色 ID
 * @param {Number} rightsId   要删除的 权限 ID
 */
export const delTags = (roleId, rightsId) => request.delete(`roles/${roleId}/rights/${rightsId})`)